home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_098 / hddriver / driver / hd.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  157 lines

  1.  
  2. /*
  3.  * Copyright 1987 Alan Kent
  4.  *
  5.  * Permission is granted to redistribute this code as long
  6.  * as this message is retained in the code and the code is
  7.  * not sold without written permission from the author.
  8.  *
  9.  * UUCP: {seismo,hplabs,mcvax,ukc,nttlab}!munnari!goanna.oz!ajk
  10.  * ACSnet: ajk@goanna.oz
  11.  * ARPA: munnari!goanna.oz!ajk@SEISMO.ARPA
  12.  */
  13.  
  14. #include "exec/types.h"
  15. #include "exec/memory.h"
  16. #include "exec/resident.h"
  17. #include "exec/libraries.h"
  18. #include "exec/devices.h"
  19. #include "exec/errors.h"
  20. #include "exec/execbase.h"
  21. #include "exec/interrupts.h"
  22. #include "libraries/dosextens.h"
  23.  
  24. #include "harddisk.h"
  25.  
  26. #define HD_VERSION        1
  27. #define HD_REVISION        1
  28. #define HD_IDSTRING        "harddisk.device 1.2 (19 Apr 1987)\r\n"
  29. #define HD_PRIORITY        1
  30. #define HD_STACKSIZE    4000
  31.  
  32.  
  33. #define PROCPTR(proc)    ((struct Process*)(((char*)(proc))-sizeof(struct Task)))
  34. #define CHANGE_COUNT    1
  35.  
  36.  
  37. extern struct hd_FirstSector first;
  38.  
  39.  
  40. /*#define DEBUG 1*/
  41.  
  42. #ifdef DEBUG
  43. #define ERROR(str)    error(str)
  44. #else
  45. #define ERROR(str)    Exit(20L)
  46. #endif
  47.  
  48.  
  49. struct hd_msg {
  50.     struct Message    hdm_Msg;
  51.     struct hd_dev *    hdm_Device;
  52.     struct hd_unit *hdm_Unit;
  53. };
  54.  
  55.  
  56. struct hd_unit {
  57.     struct Unit    hdu_Unit;
  58.     ULONG        hdu_Flags;
  59.     UBYTE        hdu_UnitNum;
  60.     UBYTE        pad;
  61.     struct hd_msg hdu_Msg;
  62.     struct Task *hdu_Task;
  63. };
  64.  
  65.  
  66. struct hd_dev {
  67.     struct Device    hd_Dev;
  68.     struct hd_unit    hd_Unit[ HD_NUMUNITS ];
  69.     ULONG            hd_Flags;
  70.     BPTR            hd_SegList;        /* I think its BPTR */
  71. };
  72.  
  73.  
  74. struct posn {
  75.     LONG    block;
  76.     LONG    cylinder;    /* -ve cylinder means not in use */
  77.     LONG    surface;
  78.     LONG    sector;
  79. };
  80.  
  81.  
  82.  
  83.  
  84. /* all the functions used */
  85.  
  86. extern void                ReplyMsg ();
  87. extern struct Message *    GetMsg ();
  88. extern APTR                AllocMem ();
  89. extern void                FreeMem ();
  90. extern APTR                OpenLibrary ();
  91. extern LONG                AllocSignal ();
  92. extern struct Task *    FindTask ();
  93. extern struct Library *    MakeLibrary ();
  94. extern struct MsgPort *    CreatePort ();
  95. extern struct Process *    CreateProc ();
  96. extern struct Message *    WaitPort ();
  97.  
  98.  
  99.  
  100. /* my functions */
  101.  
  102. extern LONG        aOpen ();
  103. extern LONG        aClose ();
  104. extern LONG        aExpunge ();
  105. extern LONG        aNull ();
  106. extern LONG        aBeginIO ();
  107. extern LONG        aAbortIO ();
  108. extern struct hd_dev*cOpen ();
  109. extern BPTR        cClose ();
  110. extern BPTR        cExpunge ();
  111. extern void        cBeginIO ();
  112. extern void        cAbortIO ();
  113. extern int        init_cache ();
  114. extern void        free_cache ();
  115. extern BOOL        calc ();
  116. extern UBYTE *    read_cache ();
  117. extern void        write_cache ();
  118. extern void        perform_io ();
  119. extern int        find_empty_cache ();
  120. extern void        flush_track ();
  121. extern void        flush_all ();
  122. extern void        clear_all ();
  123. extern int        wd_open ();
  124. extern void        wd_close ();
  125. extern int        wd_format_track ();
  126. extern int        wd_seek ();
  127. extern int        wd_cmd ();
  128. extern int        read_sector ();
  129. extern int        write_sector ();
  130. extern void        copy_sector ();
  131. extern void        error ();
  132. extern LONG        aLibInit ();
  133. extern LONG        cLibInit ();
  134. extern void        subprocess ();
  135. extern LONG        HDHandler ();
  136.  
  137.  
  138. /* globals */
  139.  
  140. extern struct DosLibrary *    DOSBase;
  141. extern struct ExecBase *    SysBase;
  142.  
  143.  
  144. extern struct posn        cur_posn;    /* set by read_sector and write_sector */
  145.  
  146. extern LONG                bad_error;    /* set by read_sector and write_sector */
  147. extern struct posn        bad_posn;
  148.  
  149. extern char                dev_name[];
  150. extern char                dev_id_string[];
  151.  
  152. extern LONG                proc_seg_list[];    /* well, pretty close */
  153.  
  154. extern struct Interrupt *HDInterrupt;
  155.  
  156. extern struct MsgPort *    port;
  157.